package com.young.weixin.model.message;

import com.thoughtworks.xstream.annotations.XStreamAlias;
import com.young.weixin.model.enums.EWxMessageTypeEnum;

/**
 * 链接消息
 *
 * @author wangjiyu
 * @date 2021/10/5 17:05
 */
@XStreamAlias("xml")
public class WxLinkMessage extends WxBaseMessage {
    /**
     * 消息标题
     */
    @XStreamAlias("Title")
    private String title;
    /**
     * 消息描述
     */
    @XStreamAlias("Description")
    private String description;
    /**
     * 	消息链接
     */
    @XStreamAlias("Url")
    private String url;

    /**
     * 构造消息对象
     *
     * @param fromUser 发送人
     * @param toUser   接收人
     * @return 消息对象
     */
    @Override
    public WxLinkMessage build(String fromUser, String toUser) {
        WxLinkMessage message = new WxLinkMessage();
        message.fillWxBaseMessage(fromUser, toUser, EWxMessageTypeEnum.LINK);
        return message;
    }

    /**
     * 构造消息对象
     *
     * @param messageMapWrapper 参数map
     * @return 消息对象
     */
    @Override
    public WxLinkMessage convert(WxMessageMapWrapper messageMapWrapper) {
        WxLinkMessage message = new WxLinkMessage();
        message.fillWxBaseMessage(messageMapWrapper);
        message.setTitle(messageMapWrapper.getTitle());
        message.setDescription(messageMapWrapper.getDescription());
        message.setUrl(messageMapWrapper.getUrl());
        return message;
    }

    public WxLinkMessage() {
        super();
    }


    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }
}
